CC = gcc

LEX = flex
YACC = bison

JNI_INCLUDES = -I$(JAVA_HOME)/include -I$(JAVA_HOME)/include/linux
JNI_LIBS = -L$(JAVA_HOME)/jre/lib/i386/server -ljvm

CFLAGS = -fpic -shared $(JNI_INCLUDES) #-g

LIBS = 

OBJS = HelloJni.o
SRCS = $(OBJS:.o=.c)

TARGET = libhellojni.so

$(TARGET) : $(OBJS)
	$(CC) $(CFLAGS) $(INCLUDES) $(OBJS) $(LIBS) -o $(TARGET)

clean : 
	rm -f $(TARGET) $(OBJS)

test : $(TARGET)
	javac HelloJni.java
	javap -s -private HelloJni
	javah -jni HelloJni
	export LD_LIBRARY_PATH=.
	java HelloJni

inv : $(TARGET)
	$(CC) $(JNI_INCLUDES) $(JNI_LIBS) InvocJni.c -o InvocJni
	export LD_LIBRARY_PATH=.:$(JAVA_HOME)/jre/lib/i386/server
	./InvocJni

